package org.taobao.ibatiside.ui.util;

import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IProject;
import org.taobao.ibatiside.core.IbatisConstant;
import org.taobao.ibatiside.core.filemodel.FileProber;

public class BatisTester extends PropertyTester {

	public BatisTester() {
	}

	@Override
	public boolean test(Object receiver, String property, Object[] args,
			Object expectedValue) {
		if ("project".equals(property) && (receiver instanceof IProject) && (expectedValue instanceof Boolean)){
			IProject test_project = (IProject) receiver;
			int pv = FileProber.getIbatisVerion(test_project);
			return (pv != IbatisConstant.NOT_IBATIS) == ((Boolean)expectedValue).booleanValue();
		}
		return false;
	}

}
